<template>
	<div id="user">

		<div class="navbar navbar-expand-sm bg-info text-black navSize">
			<ul class="navbar-nav navPos">
				<li class="nav-item lifl1">
					<router-link :to="{name:'userInfo'}">用户信息</router-link>
				</li>
				<li class="nav-item lifl2">
					<router-link :to="{name:'userPost'}">用户帖子</router-link>
				</li>
				<li class="nav-item lifl3">
					<router-link :to="{name:'userComment'}">用户评论</router-link>
				</li>
				<li class="nav-item lifl4">
					<router-link :to="{name:'manageForum'}" v-if="level == 1">版块管理</router-link>
				</li>
				<li class="nav-item lifl5">
					<router-link :to="{name:'apply'}" v-if="level == 0">版主申请</router-link>
				</li>

			</ul>

		</div>
		<div>
			<router-view />
		</div>

	</div>

</template>

<script>
	export default {
		data() {
			return {
					level:'',
			}
		},
		created() {
			this.isLogin();
		},
		methods: {
			isLogin() {
				if(this.$store.state.user == null) {
					alert("请先登录！");
					this.$router.push({
						name: 'login'
					});
				}else{
					this.level = this.$store.state.user[0].level ;
				}
			}
		}
	}
</script>

<style scoped>
	a {
		padding: 0;
		padding-top: 6px;
	}
	
	.router-link-active {
		color: red;
		font-size: large;
	}
</style>